package com.xumt.hwHMSdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.xumt.hwHMSdemo.PieGraph;

public class bztActivity extends AppCompatActivity {
private PieGraph pieGraph;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bzt);
       pieGraph = findViewById(R.id.pie1);
        //pieView = findViewById(R.id.pie2);



        initData();
    }

    private void initData() {
        //饼状图1
      int color[]={0xFFFFFF99,0xFF663300,0xFF999933,0xFFCC3333,0xFFFFFF00,0xFF336699,0xFFCC3366,0xFFCC9999,0xFF336633,0xFFFFFF00,0xFFFF6666,0xFF993399};
        List<PieGraph.PieDataHolder> pieceDataHolders = new ArrayList<>();
        for(int i=0;i<CommodityActivity.startlist.size();i++)
        {
            Map<String, Object> map=CommodityActivity.startlist.get(i);
            pieceDataHolders.add(new PieGraph.PieDataHolder((int)map.get("xiaoliang"), color[i%12], (String) map.get("commodityname")));
        }
//        pieceDataHolders.add(new PieGraph.PieDataHolder(10, 0xFFFFFF99, "江西"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(10, 0xFF663300, "南昌"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(10, 0xFF999933, "萍乡"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(10, 0xFFCC3333, "赣州"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(100, 0xFFFFFF00, "上饶"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(100, 0xFF336699, "小曾"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(170, 0xFF333399, "小吴"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(200, 0xFFCC3366, "小谢"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(200, 0xFFCC9999, "小明"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(200, 0xFF336633, "小高"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(200, 0xFFFFFF00, "今天"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(200, 0xFFFF6666, "明天"));
//        pieceDataHolders.add(new PieGraph.PieDataHolder(130, 0xFF993399, "后天"));
        pieGraph.setPieData(pieceDataHolders);



//        //饼状图2
//        ArrayList<PieData> datas = new ArrayList<>();
//        PieData pieData = new PieData("sloop", 20);
//        PieData pieData2 = new PieData("sloop", 20);
//        PieData pieData3 = new PieData("sloop", 20);
//        PieData pieData4 = new PieData("sloop", 20);
//        PieData pieData5 = new PieData("sloop", 80);
//        datas.add(pieData);
//        datas.add(pieData2);
//        datas.add(pieData3);
//        datas.add(pieData4);
//        datas.add(pieData5);
//        pieView.setData(datas);
    }
}